package zhengdaoyang.settings.service.impl;

import zhengdaoyang.settings.dao.GoodDao;
import zhengdaoyang.settings.dao.GoodDaoImpl;
import zhengdaoyang.settings.domain.Goods;
import zhengdaoyang.settings.service.GoodService;

import java.util.ArrayList;
import java.util.List;

public class GoodServiceImpl implements GoodService {
    private final GoodDao goodDao = new GoodDaoImpl();
    @Override
    public List<Goods> getGoodDate(String name) {
        List<Goods> goods = new ArrayList<Goods>();
        try {
            goods =  goodDao.getGoodDate(name);
        }catch (Exception e){
            e.printStackTrace();
        }
        return goods;
    }

    @Override
    public List<Goods> findallgoods(String name) {
        List<Goods> goods = new ArrayList<Goods>();
        try {
            goods =  goodDao.findallgoods(name);
        }catch (Exception e){
            e.printStackTrace();
        }
        return goods;
    }

    @Override
    public int insertcart(String name,double price) {
        int i=0;
        try {
            i= goodDao.insertcart(name,price);
        }catch (Exception e){
            e.printStackTrace();
        }

        return 0;
    }
}
